/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = '';
  
  checkConfig(config);
  @endpoint = getEndpoint('rmcore', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model CheckResourceRelationshipExistsRequest {
  sourceResource?: {
    accountId?: string(name='AccountId'),
    namespace?: string(name='Namespace'),
    regionId?: string(name='RegionId'),
    resourceId?: string(name='ResourceId'),
    resourceType?: string(name='ResourceType'),
  }(name='SourceResource'),
  targetResource?: {
    accountId?: string(name='AccountId'),
    namespace?: string(name='Namespace'),
    regionId?: string(name='RegionId'),
    resourceId?: string(name='ResourceId'),
    resourceType?: string(name='ResourceType'),
  }(name='TargetResource'),
}

model CheckResourceRelationshipExistsShrinkRequest {
  sourceResourceShrink?: string(name='SourceResource'),
  targetResourceShrink?: string(name='TargetResource'),
}

model CheckResourceRelationshipExistsResponseBody = {
  exists?: boolean(name='Exists'),
  requestId?: string(name='RequestId', description='Id of the request'),
}

model CheckResourceRelationshipExistsResponse = {
  headers: map[string]string(name='headers'),
  body: CheckResourceRelationshipExistsResponseBody(name='body'),
}

async function checkResourceRelationshipExistsWithOptions(tmpReq: CheckResourceRelationshipExistsRequest, runtime: Util.RuntimeOptions): CheckResourceRelationshipExistsResponse {
  Util.validateModel(tmpReq);
  var request = new CheckResourceRelationshipExistsShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.sourceResource)) {
    request.sourceResourceShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.sourceResource, 'SourceResource', 'json');
  }
  if (!Util.isUnset(tmpReq.targetResource)) {
    request.targetResourceShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.targetResource, 'TargetResource', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.sourceResourceShrink)) {
    query['SourceResource'] = request.sourceResourceShrink;
  }
  if (!Util.isUnset(request.targetResourceShrink)) {
    query['TargetResource'] = request.targetResourceShrink;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CheckResourceRelationshipExists',
    version = '2022-01-21',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function checkResourceRelationshipExists(request: CheckResourceRelationshipExistsRequest): CheckResourceRelationshipExistsResponse {
  var runtime = new Util.RuntimeOptions{};
  return checkResourceRelationshipExistsWithOptions(request, runtime);
}

model CreateResourceTypeRequest {
  resourceTypeConfiguration?: map[string]any(name='ResourceTypeConfiguration'),
}

model CreateResourceTypeShrinkRequest {
  resourceTypeConfigurationShrink?: string(name='ResourceTypeConfiguration'),
}

model CreateResourceTypeResponseBody = {
  requestId?: string(name='RequestId'),
}

model CreateResourceTypeResponse = {
  headers: map[string]string(name='headers'),
  body: CreateResourceTypeResponseBody(name='body'),
}

async function createResourceTypeWithOptions(tmpReq: CreateResourceTypeRequest, runtime: Util.RuntimeOptions): CreateResourceTypeResponse {
  Util.validateModel(tmpReq);
  var request = new CreateResourceTypeShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.resourceTypeConfiguration)) {
    request.resourceTypeConfigurationShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.resourceTypeConfiguration, 'ResourceTypeConfiguration', 'json');
  }
  var body : map[string]any= {};
  if (!Util.isUnset(request.resourceTypeConfigurationShrink)) {
    body['ResourceTypeConfiguration'] = request.resourceTypeConfigurationShrink;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateResourceType',
    version = '2022-01-21',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createResourceType(request: CreateResourceTypeRequest): CreateResourceTypeResponse {
  var runtime = new Util.RuntimeOptions{};
  return createResourceTypeWithOptions(request, runtime);
}

model DeleteApiRequest {
  apiName?: string(name='ApiName', description='目标资源组'),
  apiProductCode?: string(name='ApiProductCode', description='资源Id'),
  apiProductVersion?: string(name='ApiProductVersion', description='地域Id'),
  resourceType?: string(name='ResourceType', description='资源类型'),
  service?: string(name='Service', description='云产品服务Code'),
}

model DeleteApiResponseBody = {
  requestId?: string(name='RequestId', description='Id of the request'),
}

model DeleteApiResponse = {
  headers: map[string]string(name='headers'),
  body: DeleteApiResponseBody(name='body'),
}

async function deleteApiWithOptions(request: DeleteApiRequest, runtime: Util.RuntimeOptions): DeleteApiResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.apiName)) {
    query['ApiName'] = request.apiName;
  }
  if (!Util.isUnset(request.apiProductCode)) {
    query['ApiProductCode'] = request.apiProductCode;
  }
  if (!Util.isUnset(request.apiProductVersion)) {
    query['ApiProductVersion'] = request.apiProductVersion;
  }
  if (!Util.isUnset(request.resourceType)) {
    query['ResourceType'] = request.resourceType;
  }
  if (!Util.isUnset(request.service)) {
    query['Service'] = request.service;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteApi',
    version = '2022-01-21',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function deleteApi(request: DeleteApiRequest): DeleteApiResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteApiWithOptions(request, runtime);
}

model DeleteResourceTypeRequest {
  namespace?: string(name='Namespace'),
  resourceType?: string(name='ResourceType'),
}

model DeleteResourceTypeResponseBody = {
  requestId?: string(name='RequestId'),
  resourceType?: map[string]any(name='ResourceType'),
}

model DeleteResourceTypeResponse = {
  headers: map[string]string(name='headers'),
  body: DeleteResourceTypeResponseBody(name='body'),
}

async function deleteResourceTypeWithOptions(request: DeleteResourceTypeRequest, runtime: Util.RuntimeOptions): DeleteResourceTypeResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.namespace)) {
    query['Namespace'] = request.namespace;
  }
  if (!Util.isUnset(request.resourceType)) {
    query['ResourceType'] = request.resourceType;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteResourceType',
    version = '2022-01-21',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function deleteResourceType(request: DeleteResourceTypeRequest): DeleteResourceTypeResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteResourceTypeWithOptions(request, runtime);
}

model DisableResourceTypeRequest {
  namespace?: string(name='Namespace'),
  resourceType?: string(name='ResourceType'),
}

model DisableResourceTypeResponseBody = {
  requestId?: string(name='RequestId'),
  resourceType?: map[string]any(name='ResourceType'),
}

model DisableResourceTypeResponse = {
  headers: map[string]string(name='headers'),
  body: DisableResourceTypeResponseBody(name='body'),
}

async function disableResourceTypeWithOptions(request: DisableResourceTypeRequest, runtime: Util.RuntimeOptions): DisableResourceTypeResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.namespace)) {
    query['Namespace'] = request.namespace;
  }
  if (!Util.isUnset(request.resourceType)) {
    query['ResourceType'] = request.resourceType;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DisableResourceType',
    version = '2022-01-21',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function disableResourceType(request: DisableResourceTypeRequest): DisableResourceTypeResponse {
  var runtime = new Util.RuntimeOptions{};
  return disableResourceTypeWithOptions(request, runtime);
}

model EnableResourceTypeRequest {
  namespace?: string(name='Namespace'),
  resourceType?: string(name='ResourceType'),
}

model EnableResourceTypeResponseBody = {
  requestId?: string(name='RequestId'),
  resourceType?: map[string]any(name='ResourceType'),
}

model EnableResourceTypeResponse = {
  headers: map[string]string(name='headers'),
  body: EnableResourceTypeResponseBody(name='body'),
}

async function enableResourceTypeWithOptions(request: EnableResourceTypeRequest, runtime: Util.RuntimeOptions): EnableResourceTypeResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.namespace)) {
    query['Namespace'] = request.namespace;
  }
  if (!Util.isUnset(request.resourceType)) {
    query['ResourceType'] = request.resourceType;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'EnableResourceType',
    version = '2022-01-21',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function enableResourceType(request: EnableResourceTypeRequest): EnableResourceTypeResponse {
  var runtime = new Util.RuntimeOptions{};
  return enableResourceTypeWithOptions(request, runtime);
}

model GetUnditerminedRequestRequest {
  originRequestId?: string(name='OriginRequestId'),
}

model GetUnditerminedRequestResponseBody = {
  accountId?: string(name='AccountId'),
  apiName?: string(name='ApiName'),
  context?: string(name='Context'),
  gmtCreate?: string(name='GmtCreate'),
  gmtModified?: string(name='GmtModified'),
  operationType?: string(name='OperationType'),
  originContext?: string(name='OriginContext'),
  originRequestId?: string(name='OriginRequestId'),
  product?: string(name='Product'),
  regionId?: string(name='RegionId'),
  requestId?: string(name='RequestId', description='Id of the request'),
  requestTime?: string(name='RequestTime'),
  resourceGroupId?: string(name='ResourceGroupId'),
  resourceId?: string(name='ResourceId'),
  resourceType?: string(name='ResourceType'),
  service?: string(name='Service'),
  status?: string(name='Status'),
  version?: string(name='Version'),
}

model GetUnditerminedRequestResponse = {
  headers: map[string]string(name='headers'),
  body: GetUnditerminedRequestResponseBody(name='body'),
}

async function getUnditerminedRequestWithOptions(request: GetUnditerminedRequestRequest, runtime: Util.RuntimeOptions): GetUnditerminedRequestResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.originRequestId)) {
    query['OriginRequestId'] = request.originRequestId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetUnditerminedRequest',
    version = '2022-01-21',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getUnditerminedRequest(request: GetUnditerminedRequestRequest): GetUnditerminedRequestResponse {
  var runtime = new Util.RuntimeOptions{};
  return getUnditerminedRequestWithOptions(request, runtime);
}

model ListResourceBasicInfoRequest {
  accountId?: string(name='AccountId'),
  resourceIds?: string(name='ResourceIds'),
  resourceType?: string(name='ResourceType'),
  service?: string(name='Service'),
}

model ListResourceBasicInfoResponseBody = {
  errorCode?: string(name='ErrorCode'),
  requestId?: string(name='RequestId', description='Id of the request'),
  resources?: [ 
    {
      accountId?: string(name='AccountId'),
      regionId?: string(name='RegionId'),
      resourceGroupId?: string(name='ResourceGroupId'),
      resourceId?: string(name='ResourceId'),
      resourceType?: string(name='ResourceType'),
      service?: string(name='Service'),
    }
  ](name='Resources'),
  success?: string(name='Success'),
}

model ListResourceBasicInfoResponse = {
  headers: map[string]string(name='headers'),
  body: ListResourceBasicInfoResponseBody(name='body'),
}

async function listResourceBasicInfoWithOptions(request: ListResourceBasicInfoRequest, runtime: Util.RuntimeOptions): ListResourceBasicInfoResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.accountId)) {
    query['AccountId'] = request.accountId;
  }
  if (!Util.isUnset(request.resourceIds)) {
    query['ResourceIds'] = request.resourceIds;
  }
  if (!Util.isUnset(request.resourceType)) {
    query['ResourceType'] = request.resourceType;
  }
  if (!Util.isUnset(request.service)) {
    query['Service'] = request.service;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListResourceBasicInfo',
    version = '2022-01-21',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listResourceBasicInfo(request: ListResourceBasicInfoRequest): ListResourceBasicInfoResponse {
  var runtime = new Util.RuntimeOptions{};
  return listResourceBasicInfoWithOptions(request, runtime);
}

model ListResourceRelationshipRequest {
  accountId?: string(name='AccountId'),
  maxResults?: int32(name='MaxResults'),
  nextToken?: string(name='NextToken'),
  resourceId?: string(name='ResourceId'),
  resourceType?: string(name='ResourceType'),
  service?: string(name='Service'),
}

model ListResourceRelationshipResponseBody = {
  maxResults?: int32(name='MaxResults'),
  nextToken?: string(name='NextToken'),
  requestId?: string(name='RequestId', description='Id of the request'),
  resources?: [ 
    {
      accountId?: string(name='AccountId'),
      namespace?: string(name='Namespace'),
      regionId?: string(name='RegionId'),
      resourceId?: string(name='ResourceId'),
      resourceType?: string(name='ResourceType'),
    }
  ](name='Resources'),
}

model ListResourceRelationshipResponse = {
  headers: map[string]string(name='headers'),
  body: ListResourceRelationshipResponseBody(name='body'),
}

async function listResourceRelationshipWithOptions(request: ListResourceRelationshipRequest, runtime: Util.RuntimeOptions): ListResourceRelationshipResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.accountId)) {
    query['AccountId'] = request.accountId;
  }
  if (!Util.isUnset(request.maxResults)) {
    query['MaxResults'] = request.maxResults;
  }
  if (!Util.isUnset(request.nextToken)) {
    query['NextToken'] = request.nextToken;
  }
  if (!Util.isUnset(request.resourceId)) {
    query['ResourceId'] = request.resourceId;
  }
  if (!Util.isUnset(request.resourceType)) {
    query['ResourceType'] = request.resourceType;
  }
  if (!Util.isUnset(request.service)) {
    query['Service'] = request.service;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListResourceRelationship',
    version = '2022-01-21',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listResourceRelationship(request: ListResourceRelationshipRequest): ListResourceRelationshipResponse {
  var runtime = new Util.RuntimeOptions{};
  return listResourceRelationshipWithOptions(request, runtime);
}

model ListResourcesRequest {
  accountId?: string(name='AccountId'),
  apiName?: string(name='ApiName'),
  apiVersion?: string(name='ApiVersion'),
  params?: string(name='Params'),
  productCode?: string(name='ProductCode'),
  resourceType?: string(name='ResourceType'),
  service?: string(name='Service'),
}

model ListResourcesResponseBody = {
  data?: string(name='Data'),
  requestId?: string(name='RequestId', description='Id of the request'),
}

model ListResourcesResponse = {
  headers: map[string]string(name='headers'),
  body: ListResourcesResponseBody(name='body'),
}

async function listResourcesWithOptions(request: ListResourcesRequest, runtime: Util.RuntimeOptions): ListResourcesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.accountId)) {
    query['AccountId'] = request.accountId;
  }
  if (!Util.isUnset(request.apiName)) {
    query['ApiName'] = request.apiName;
  }
  if (!Util.isUnset(request.apiVersion)) {
    query['ApiVersion'] = request.apiVersion;
  }
  if (!Util.isUnset(request.params)) {
    query['Params'] = request.params;
  }
  if (!Util.isUnset(request.productCode)) {
    query['ProductCode'] = request.productCode;
  }
  if (!Util.isUnset(request.resourceType)) {
    query['ResourceType'] = request.resourceType;
  }
  if (!Util.isUnset(request.service)) {
    query['Service'] = request.service;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListResources',
    version = '2022-01-21',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listResources(request: ListResourcesRequest): ListResourcesResponse {
  var runtime = new Util.RuntimeOptions{};
  return listResourcesWithOptions(request, runtime);
}

model MoveResourceGroupRequest {
  regionId?: string(name='RegionId', description='地域Id'),
  resourceGroupId?: string(name='ResourceGroupId', description='目标资源组'),
  resourceId?: string(name='ResourceId', description='资源Id'),
  resourceType?: string(name='ResourceType', description='资源类型'),
  service?: string(name='Service', description='云产品服务Code'),
}

model MoveResourceGroupResponseBody = {
  requestId?: string(name='RequestId', description='Id of the request'),
}

model MoveResourceGroupResponse = {
  headers: map[string]string(name='headers'),
  body: MoveResourceGroupResponseBody(name='body'),
}

async function moveResourceGroupWithOptions(request: MoveResourceGroupRequest, runtime: Util.RuntimeOptions): MoveResourceGroupResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.resourceId)) {
    query['ResourceId'] = request.resourceId;
  }
  if (!Util.isUnset(request.resourceType)) {
    query['ResourceType'] = request.resourceType;
  }
  if (!Util.isUnset(request.service)) {
    query['Service'] = request.service;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'MoveResourceGroup',
    version = '2022-01-21',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function moveResourceGroup(request: MoveResourceGroupRequest): MoveResourceGroupResponse {
  var runtime = new Util.RuntimeOptions{};
  return moveResourceGroupWithOptions(request, runtime);
}

model QueryResourceTypeRequest {
  namespace?: string(name='Namespace'),
  resourceType?: string(name='ResourceType'),
}

model QueryResourceTypeResponseBody = {
  requestId?: string(name='RequestId'),
  resourceType?: map[string]any(name='ResourceType'),
}

model QueryResourceTypeResponse = {
  headers: map[string]string(name='headers'),
  body: QueryResourceTypeResponseBody(name='body'),
}

async function queryResourceTypeWithOptions(request: QueryResourceTypeRequest, runtime: Util.RuntimeOptions): QueryResourceTypeResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.namespace)) {
    query['Namespace'] = request.namespace;
  }
  if (!Util.isUnset(request.resourceType)) {
    query['ResourceType'] = request.resourceType;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QueryResourceType',
    version = '2022-01-21',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function queryResourceType(request: QueryResourceTypeRequest): QueryResourceTypeResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryResourceTypeWithOptions(request, runtime);
}

model SyncApiRequest {
  apiDefinitions?: string(name='ApiDefinitions'),
}

model SyncApiResponseBody = {
  requestId?: string(name='RequestId'),
}

model SyncApiResponse = {
  headers: map[string]string(name='headers'),
  body: SyncApiResponseBody(name='body'),
}

async function syncApiWithOptions(request: SyncApiRequest, runtime: Util.RuntimeOptions): SyncApiResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.apiDefinitions)) {
    query['ApiDefinitions'] = request.apiDefinitions;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SyncApi',
    version = '2022-01-21',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function syncApi(request: SyncApiRequest): SyncApiResponse {
  var runtime = new Util.RuntimeOptions{};
  return syncApiWithOptions(request, runtime);
}

model SyncApiRamMetaRequest {
  apiRamMetas?: string(name='ApiRamMetas'),
}

model SyncApiRamMetaResponseBody = {
  requestId?: string(name='RequestId'),
}

model SyncApiRamMetaResponse = {
  headers: map[string]string(name='headers'),
  body: SyncApiRamMetaResponseBody(name='body'),
}

async function syncApiRamMetaWithOptions(request: SyncApiRamMetaRequest, runtime: Util.RuntimeOptions): SyncApiRamMetaResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.apiRamMetas)) {
    query['ApiRamMetas'] = request.apiRamMetas;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SyncApiRamMeta',
    version = '2022-01-21',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function syncApiRamMeta(request: SyncApiRamMetaRequest): SyncApiRamMetaResponse {
  var runtime = new Util.RuntimeOptions{};
  return syncApiRamMetaWithOptions(request, runtime);
}

model SyncResourceOperationRequest {
  accountId?: string(name='AccountId', description='资源所属账号Id'),
  operationTimestamp?: long(name='OperationTimestamp'),
  operationType?: string(name='OperationType', description='操作类型'),
  regionId?: string(name='RegionId', description='地域Id'),
  resourceGroupId?: string(name='ResourceGroupId', description='目标资源组'),
  resourceId?: string(name='ResourceId', description='资源Id'),
  resourceType?: string(name='ResourceType', description='资源类型'),
  service?: string(name='Service', description='云产品服务Code'),
}

model SyncResourceOperationResponseBody = {
  requestId?: string(name='RequestId', description='Id of the request'),
}

model SyncResourceOperationResponse = {
  headers: map[string]string(name='headers'),
  body: SyncResourceOperationResponseBody(name='body'),
}

async function syncResourceOperationWithOptions(request: SyncResourceOperationRequest, runtime: Util.RuntimeOptions): SyncResourceOperationResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.accountId)) {
    query['AccountId'] = request.accountId;
  }
  if (!Util.isUnset(request.operationTimestamp)) {
    query['OperationTimestamp'] = request.operationTimestamp;
  }
  if (!Util.isUnset(request.operationType)) {
    query['OperationType'] = request.operationType;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.resourceId)) {
    query['ResourceId'] = request.resourceId;
  }
  if (!Util.isUnset(request.resourceType)) {
    query['ResourceType'] = request.resourceType;
  }
  if (!Util.isUnset(request.service)) {
    query['Service'] = request.service;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SyncResourceOperation',
    version = '2022-01-21',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function syncResourceOperation(request: SyncResourceOperationRequest): SyncResourceOperationResponse {
  var runtime = new Util.RuntimeOptions{};
  return syncResourceOperationWithOptions(request, runtime);
}

model TagResourceGroupRequest {
  accountId?: string(name='AccountId'),
  notifyRmc?: boolean(name='NotifyRmc'),
  regionId?: string(name='RegionId', description='地域Id'),
  resourceGroupId?: string(name='ResourceGroupId', description='目标资源组'),
  resourceId?: string(name='ResourceId', description='资源Id'),
  resourceType?: string(name='ResourceType', description='资源类型'),
  service?: string(name='Service', description='云产品服务Code'),
  updateFollowerResourceGroup?: boolean(name='UpdateFollowerResourceGroup'),
}

model TagResourceGroupResponseBody = {
  requestId?: string(name='RequestId', description='Id of the request'),
}

model TagResourceGroupResponse = {
  headers: map[string]string(name='headers'),
  body: TagResourceGroupResponseBody(name='body'),
}

async function tagResourceGroupWithOptions(request: TagResourceGroupRequest, runtime: Util.RuntimeOptions): TagResourceGroupResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.accountId)) {
    query['AccountId'] = request.accountId;
  }
  if (!Util.isUnset(request.notifyRmc)) {
    query['NotifyRmc'] = request.notifyRmc;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.resourceId)) {
    query['ResourceId'] = request.resourceId;
  }
  if (!Util.isUnset(request.resourceType)) {
    query['ResourceType'] = request.resourceType;
  }
  if (!Util.isUnset(request.service)) {
    query['Service'] = request.service;
  }
  if (!Util.isUnset(request.updateFollowerResourceGroup)) {
    query['UpdateFollowerResourceGroup'] = request.updateFollowerResourceGroup;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'TagResourceGroup',
    version = '2022-01-21',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function tagResourceGroup(request: TagResourceGroupRequest): TagResourceGroupResponse {
  var runtime = new Util.RuntimeOptions{};
  return tagResourceGroupWithOptions(request, runtime);
}

model UntagResourceAllTagsRequest {
  accountId?: string(name='AccountId'),
  resourceIds?: [ string ](name='ResourceIds', description='资源Id'),
  resourceType?: string(name='ResourceType', description='资源类型'),
  service?: string(name='Service', description='云产品服务Code'),
}

model UntagResourceAllTagsResponseBody = {
  requestId?: string(name='RequestId', description='Id of the request'),
}

model UntagResourceAllTagsResponse = {
  headers: map[string]string(name='headers'),
  body: UntagResourceAllTagsResponseBody(name='body'),
}

async function untagResourceAllTagsWithOptions(request: UntagResourceAllTagsRequest, runtime: Util.RuntimeOptions): UntagResourceAllTagsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.accountId)) {
    query['AccountId'] = request.accountId;
  }
  if (!Util.isUnset(request.resourceIds)) {
    query['ResourceIds'] = request.resourceIds;
  }
  if (!Util.isUnset(request.resourceType)) {
    query['ResourceType'] = request.resourceType;
  }
  if (!Util.isUnset(request.service)) {
    query['Service'] = request.service;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'UntagResourceAllTags',
    version = '2022-01-21',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function untagResourceAllTags(request: UntagResourceAllTagsRequest): UntagResourceAllTagsResponse {
  var runtime = new Util.RuntimeOptions{};
  return untagResourceAllTagsWithOptions(request, runtime);
}

model UpdateResourceTypeRequest {
  path?: [ string ](name='Path'),
  resourceTypeConfiguration?: map[string]any(name='ResourceTypeConfiguration'),
}

model UpdateResourceTypeShrinkRequest {
  path?: [ string ](name='Path'),
  resourceTypeConfigurationShrink?: string(name='ResourceTypeConfiguration'),
}

model UpdateResourceTypeResponseBody = {
  requestId?: string(name='RequestId'),
}

model UpdateResourceTypeResponse = {
  headers: map[string]string(name='headers'),
  body: UpdateResourceTypeResponseBody(name='body'),
}

async function updateResourceTypeWithOptions(tmpReq: UpdateResourceTypeRequest, runtime: Util.RuntimeOptions): UpdateResourceTypeResponse {
  Util.validateModel(tmpReq);
  var request = new UpdateResourceTypeShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.resourceTypeConfiguration)) {
    request.resourceTypeConfigurationShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.resourceTypeConfiguration, 'ResourceTypeConfiguration', 'json');
  }
  var body : map[string]any= {};
  if (!Util.isUnset(request.path)) {
    body['Path'] = request.path;
  }
  if (!Util.isUnset(request.resourceTypeConfigurationShrink)) {
    body['ResourceTypeConfiguration'] = request.resourceTypeConfigurationShrink;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpdateResourceType',
    version = '2022-01-21',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function updateResourceType(request: UpdateResourceTypeRequest): UpdateResourceTypeResponse {
  var runtime = new Util.RuntimeOptions{};
  return updateResourceTypeWithOptions(request, runtime);
}

